<script type="text/javascript">

	function send_order()
	{
		$checkbox = $('.validation input');
		if($checkbox.is(':checked')){
			$('.buttons').fadeOut('fast',function(){
				$('.loader').fadeIn('fast',function(){
						document.sendorder.submit();
					});
			})
			}else{
					$('.validation').css('border','2px dotted red');
				}
	}
	
</script>
<div class="ctn_delivery">

	<div class="order_info">
		<p>MA COMMANDE</p>
		<?php $i = 1; ?>
		<?php if(!$this->cart->contents()){redirect('cart');}?>

		<?php foreach ($this->cart->contents() as $items): ?>
		<div class="order_item">
			<span class="product_item"> <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
			<?=$items['product_num']?>. <?php echo $items['name']; ?> </span> <span
				class="qty_form"> <?php echo $this->cart->format_number($items['price']); ?>
				<?php if($items['options_price'] !=NULL && $items['options_price'] != 0){ echo '<span class="error">  +'.$items['options_price'].'</span>';}?>
				€ X <?=$items['qty']?>= <?php echo $this->cart->format_number($items['subtotal'] + $items['options_price']*$items['qty']); ?>
				€ </span><br> <span class="option"><?php if($this->cart->has_options($items['rowid'])==TRUE):?><label><small>OPTIONs:
				</small> </label> <?php foreach ($this->cart->product_options($items['rowid']) as $option): ?>
				<?=nbs(3)?> <small><?php echo $option['option_name']; ?> <?php if( $option['price'] !=NULL ){ echo ': '.$option['price'].' €';} ?>
			</small> <?=nbs(3)?> <?php endforeach; ?> <?php endif; ?> </span>
			<div class="clear"></div>

		</div>

		<?php $i++; ?>

		<?php endforeach; ?>
		<br>
		<?php if($this->discount){?>
		<h3>
			Réduction:
			<?=$this->discount[0]->discount_val*100?>
			%<br>
		</h3>
		<?php if($post['extra'] !=0){?><h3>Frais supplémentaire: <?=$post['extra']?> €</h3><?php }?>
		<div class="total"><span>Total: <?=number_format($this->cart->total()*(1-$this->discount[0]->discount_val)+$post['extra'],'1','.','')?> </span></div>
		<?php }else{?>
		<?php if($post['extra'] !=0){?><h3>Frais supplémentaire: <?=$post['extra']?> €</h3><?php }?>
		<div class="total"><span>Total: <?=number_format($this->cart->total()+$post['extra'],'1','.','')?> </span></div>
		<?php }?>
		<div class="clear"></div>
		<div class="validation"><span class="txt_highlight">&#9733;</span> Avez-vous bien vérifier les informations de votre commande ? <br><small>( <span class="txt_highlight">le type de commande, le magasin et l'heure à emporter, etc...  </span>)</small>
		<p><input type="checkbox" id="valide"><small> J'ai lu les conditions générales de vente & conditions de livraison et j'y adhère sans réserve. <br>(<a href="<?=site_url('conditions')?>" target="_blank">Lire les Conditions générales de vente & conditions de livraison</a>)</small></p>
		<hr>
		Vous voulez encore modifier cette commande ? <a href="<?=site_url('cart')?>">Modifier</a> 
		</div>
		
	</div>
	
	<div class="info_box">
		<form action="<?=site_url('cart/send_delivery')?>" method="post" name="sendorder">
			<div class="shop">
				
				<h3>Adresse de livraison</h3>
				<br>
				<label>SONNETTE:</label><?=$address->ring?>
				<label>ADRESSE</label><?=$address->house_num?>,&nbsp; <?=$address->address?><br><?=$address->postal?> <?=$address->community?>
				<?php if($address->company !=NULL){?><label>SOCIETE</label><?=$address->company?><?php }?>
				<label>TELEPHONE</label><?=$address->tele?>
				<br><br>
				<h3>Message supplémentaire</h3>
				<textarea rows="8" cols="35" name="extra_msg"></textarea>
				<input type="hidden" value="<?=$post['delivery_time']?>"
					name="delivery_time">
					<?php if($post['order_type']=='reservation'):?>
				<input type="hidden"
					value="<?=$post['datepicker']?>"
					name="reservation">
					<?php endif;?>
				<input type="hidden" value="<?=$post['delivery_shop']?>" name="shop_id">
				<input type="hidden" value="<?=$post['extra']?>" name="extra">
				<input type="hidden" value="<?php if($this->discount){?><?=$this->discount[0]->discount_val?><?php }else{?>NULL<?php }?>" name="discount_total">
				
			</div>
			<div class="shop">
			<h3>
					Commande
					<?=($post['order_type']=='normal')? 'Aujourd&rsquo;hui <img src="'.base_url().'/resources/imgs/flash.png" height="18"/>' :'Réservation <img src="'.base_url().'/resources/imgs/calendar.png"/ >'?>
				</h3>
				<br><span class="txt_highlight"> Date:
				<?=($post['order_type']=='normal')? date('d-m-Y') : $post['datepicker']?>
				<br> <br> Heure de livraison:
				<?=$post['delivery_time']?>
				</span>
				<br> <br>
				<h3>Contact de Magazin </h3>
				<br>
				<h3>
				<?=$shop_info->shop_name?>
				</h3>
				<p>
				<?=$shop_info->address?>
				</p>
				<p>
					<img src="<?=base_url()?>resources/imgs/telephone.png" height="15"
						alt="telephone" title="telephone" />
						<?=$shop_info->tele?>
					<br> <img src="<?=base_url()?>resources/imgs/fax.png" height="17"
						alt="telephone" title="fax" />
						<?=$shop_info->fax?>
				</p>
				<p>
				<?=$shop_info->open_day?>
					<br>
					<?=$shop_info->open_hour?>
				</p>
				<hr>
				</div>
			
			<div class="clear"></div>
	
	</div>
		<div class="loader">
<img src="<?=base_url('resources/imgs/loader.gif')?>">
</div>
<div class="buttons">
	 <input type="button" value="validez votre commande" onclick="send_order()">
	</div>
	</form>
	<br><br>
	<div class="clear"></div>
</div>
